<div class="headbar">
	<div class="position"><span>会员</span><span>></span><span>会员管理</span><span>></span><span>会员列表</span></div>

	<div class="operating">
		<div class="search f_r">
			<form name="searchuser" action="{url:/}" method="get">
				<input type='hidden' name='controller' value='member' />
				<input type='hidden' name='action' value='member_list' />
				<select class="auto" name="search">
					<option value="u.username">用户名</option>
					<option value="m.true_name">姓名</option>
					<option value="m.telephone">电话</option>
					<option value="m.mobile">手机</option>
					<option value="u.email">Email</option>
				</select>
				<input class="small" name="keywords" type="text" value="{$keywords}" />
				<button class="btn" type="submit"><span class="sch">搜 索</span></button>
			</form>
		</div>

		<a href="javascript:void(0);"><button class="operating_btn" type="button" onclick="window.location='{url:/member/member_edit}'"><span class="addition">添加会员</span></button></a>
		<a href="javascript:void(0);" onclick="selectAll('check[]')"><button class="operating_btn" type="button"><span class="sel_all">全选</span></button></a>
		<a href="javascript:void(0);" onclick="delModel({form:'member_list',msg:'确定要删除所选中的会员吗？<br />删除的会员可以从回收站找回。'})"><button class="operating_btn" type="button"><span class="delete">批量删除</span></button></a>
		<a href="javascript:void(0);"><button class="operating_btn" type="button" onclick="window.location='{url:/member/recycling}'"><span class="recycle">回收站</span></button></a>
		<a href="javascript:void(0);" onclick="balance_add()"><button class="operating_btn" type="button"><span class="recharge">预付款管理</span></button></a>
	</div>
	<div class="field">
		<table class="list_table">
			<colgroup>
				<col width="30px" />
				<col width="120px" />
				<col width="80px" />
				<col width="80px" />
				<col width="50px" />
				<col width="140px"/>
				<col width="80px" />
				<col width="80px" />
				<col width="50px" />
				<col width="125px" />
				<col width="120px" />
				<col />
			</colgroup>

			<thead>
				<tr>
					<th class="t_c">选择</th>
					<th>用户名</th>
					<th>会员等级</th>
					<th>姓名</th>
					<th>性别</th>
					<th>Email</th>
					<th>余额</th>
					<th>积分</th>
					<th>状态</th>
					<th>注册日期</th>
					<th>手机</th>
					<th>操作</th>
				</tr>
			</thead>
		</table>
	</div>
</div>

<form action="{url:/member/member_reclaim}" method="post" name="member_list" onsubmit="return checkboxCheck('check[]','尚未选中任何记录！')">
	<div class="content">
		<table id="list_table" class="list_table">
			<colgroup>
				<col width="30px" />
				<col width="120px" />
				<col width="80px" />
				<col width="80px" />
				<col width="50px" />
				<col width="140px"/>
				<col width="80px" />
				<col width="80px" />
				<col width="50px" />
				<col width="125px" />
				<col width="120px" />
				<col />
			</colgroup>

			<tbody>
				{set:$page= (isset($_GET['page'])&&(intval($_GET['page'])>0))?intval($_GET['page']):1;}
				{query: name=user as u join=left join member as m on m.user_id eq u.id fields=m.*,u.username,u.email where=m.status neq 2 and $where order=m.user_id desc page=$page pagesize=20}
				<tr>
					<td class="t_c"><input name="check[]" type="checkbox" value="{$item['user_id']}" /></td>
					<td title="{$item['username']}">{$item['username']}</td>
					<td title="{$group[$item['group_id']]}">{$group[$item['group_id']]}</td>
					<td title="{$item['true_name']}">{$item['true_name']}</td>
					<td>{if:$item['sex']=='1'}男{else:}女{/if}</td>
					<td title="{$item['email']}">{$item['email']}</td>
					<td title="{$item['balance']}">{$item['balance']}</td>
					<td title="{$item['point']}">{$item['point']}</td>
					<td title="{echo:Common::userStatusText($item['status'])}">{echo:Common::userStatusText($item['status'])}</td>
					<td title="{$item['time']}">{$item['time']}</td>
					<td title="{$item['mobile']}">{$item['mobile']}</td>
					<td>
						<a href="{url:/member/member_edit/uid/$item[user_id]}"><img class="operator" src="{skin:images/admin/icon_edit.gif}" alt="修改" /></a>
						<a href="javascript:void(0)" onclick="delModel({link:'{url:/member/member_reclaim/check/$item[user_id]}'})"><img class="operator" src="{skin:images/admin/icon_del.gif}" alt="删除" /></a>
					</td>
				</tr>
				{/query}
			</tbody>
		</table>
	</div>
	{$query->getPageBar()}
</form>

<script language="javascript">
//预加载
$(function(){
	var formObj = new Form('searchuser');
	formObj.init({'search':'{$search}'});
})

//预付款管理入口
function balance_add()
{
	if(!checkboxCheck('check[]','请选择要进行预付款操作的用户！'))
	{
		return;
	}

	art.dialog.open("{url:/member/member_balance}",{
	    title: '预付款管理',
	    ok:function(iframeWin, topWin)
	    {
	    	var formObject = iframeWin.document.forms['balanceForm'];
	    	formObject.onsubmit();

	    	if($(formObject).find('.invalid-text').length > 0)
	    	{
	    		return false;
	    	}

	    	//进行post提交
	    	var postData = $('[name="member_list"]').serialize()+'&'+$(formObject).serialize();
	    	$.post('{url:/member/member_recharge}',postData,function(json){
	    		if(json.flag == 'success')
	    		{
	    			tips('操作成功');
	    			window.location.reload();
	    			return false;
	    		}
	    		else
	    		{
	    			alert(json.message);
	    			return false;
	    		}
	    	},'json');
		}
	});
}
</script>
